<?php

// +----------------------------------------------------------------------
// | ShuipFCMS 前台Controller
// +----------------------------------------------------------------------
// | Copyright (c) 2012-2014 http://www.jsy360.com, All rights reserved.
// +----------------------------------------------------------------------
// | Author: 神通教育
// +----------------------------------------------------------------------

namespace Common\Controller;

class Base extends ShuipFCMS {

    //初始化
    protected function _initialize() {

        session_start();
        parent::_initialize();
        C('URL_MODEL',2); //伪静态开启
        C('TMPL_ACTION_ERROR',APP_PATH . 'Content/View/error.php'); //前台错误提示页面
        C('TMPL_ACTION_SUCCESS',APP_PATH . 'Content/View/success.php'); //前台成功提示页面
        $this->userid = service("Passport")->userid? : 0;
        $this->groupid = service("Passport")->groupid;
        $this->username= service("Passport")->username;
        $this->realname = service("Passport")->nickname;
        $this->userinfo = service("Passport")->getInfo();
        $this->modelid = $this->userinfo['modelid'];
        $this->assign('modelid', $this->modelid);
        $this->assign('uid', $this->userid);
        $this->assign('username', $this->username);
        $this->assign('realname', $this->realname);



        //静态资源路径
        $this->assign('model_extresdir', self::$Cache['Config']['siteurl'] . MODULE_EXTRESDIR);
    }

    /**
     * 模板显示 调用内置的模板引擎显示方法，
     * @access protected
     * @param string $templateFile 指定要调用的模板文件
     * 默认为空 由系统自动定位模板文件
     * @param string $charset 输出编码
     * @param string $contentType 输出类型
     * @param string $content 输出内容
     * @param string $prefix 模板缓存前缀
     * @return void
     */
    protected function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '') {
        $this->view->display(parseTemplateFile($templateFile), $charset, $contentType, $content, $prefix);
    }

    

}
